const app = getApp()
import webSocket from '../../utils/socket'
import fetch from '../../utils/services'
const {
  windowWidth,
  windowHeight
} = wx.getSystemInfoSync()
Page({
  data: {
    userInfo: {
      userId: 1,
      name: '客服1',
      avator: 'http://pic4.zhimg.com/50/v2-0019ec92840b3cda9c12445d4452e4a5_hd.jpg',
      status: 2
    },
    myInfo: {
    },
    message: '',
    list: [],
  },
  onLoad: function (options) {
    wx.setNavigationBarTitle({
      title: '客服'
    })
    const myInfo = {
      userId: app.globalData.myInfo.userCode,
      name: app.globalData.myInfo.userName,
      avator: app.globalData.myInfo.userPic,
      uid: app.globalData.myInfo.uid,
    }
    this.setData({ myInfo })
  },
  send: function(e) {
    const message = e.detail.value
    const list = this.data.list
    list.push({
      fromUserId: this.data.myInfo.userId,
      content: message
    })
    this.setData({ message: '', list })
  },
})
